package com.hundsun.fcp.webplugin;

import java.io.File;

import android.content.Context;

import com.hundsun.fcp.common.logger.AndroidLogger;
import com.hundsun.fcp.common.logger.Logger;
import com.hundsun.fcp.webplugin.util.AssetsUtil;
import com.hundsun.fcp.webplugin.util.SdCardUtil;

public class WebPluginConfig {
	private static Logger logger = AndroidLogger.getLogger();
	private static Context mContext;
	private static boolean mSeparateWebView = true;

	public static void init(Context pContext) {
		mContext = pContext.getApplicationContext();
		try {
			//AssetsUtil.copyAssetsToSDCard(mContext);
			WebPluginVerification.getInstance(mContext).compareAssetsAndSdCardVersion() ;
		} catch (Exception e) {
			logger.error("fcp webplugin 插件初始化失败", e);
		}
	}
	

	public static String getBaseDir() {
		return SdCardUtil.getBaseDir(mContext);
	}

	public static String getWebPluginDir() {
		return SdCardUtil.getSdCardWebPluginPath(mContext);
	}
	
	public static boolean existBaseDir(){
		return SdCardUtil.existBaseDir(mContext) ;
	}
	
	public static File getImgDir(){
		return new File(SdCardUtil.getImageDir(mContext)) ;
	}

	/**
	 * web html 路径
	 * 
	 * @return
	 */
	public static String getWebBundleLocation() {
		StringBuilder _StringBuilder = new StringBuilder();
		_StringBuilder.append("webplugin");
		return _StringBuilder.toString();
	}


	public static boolean isSeperateWebView() {
		return mSeparateWebView ;
	}
}
